package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class Demo06 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入英雄名:");
        String name = sc.nextLine();
        System.out.println("请输入价格:");
        int price = sc.nextInt();

        try (Connection conn = DBUtils.getConn()){
            Statement s = conn.createStatement();
           // s.execute("alter table hero change id id int primary key auto_increment ");
            s.executeUpdate("insert into hero(name,money) values('"+name+"','"+price+"')");
            System.out.println("插入成功");

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
